package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Demo07 {
    public static void main(String[] args) {
        //把英雄表中的信息查询出来
        try (Connection conn = DBUtils.getConn();){
            Statement s = conn.createStatement();
            ResultSet rs =s.executeQuery("select name,money from hero ");
            while(rs.next()){
                String name = rs.getString(1);
                int money = rs.getInt(2);
                System.out.println(name+","+money);
                System.out.println("查询成功！");
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }

    }
}
